// @ts-ignore
/* eslint-disable */
import request from '@/utils/request'

/** 此处后端没有提供注释 GET /product/${param0} */
export async function getProductById(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: MallService.getProductByIdParams,
  options?: { [key: string]: any }
) {
  const { productId: param0, ...queryParams } = params
  return request<MallService.ResultListBizProduct>(`/mall/product/${param0}`, {
    method: 'GET',
    params: { ...queryParams },
    ...(options || {}),
  })
}

/** 此处后端没有提供注释 POST /product/add */
export async function addProduct(body: MallService.BizProduct, options?: { [key: string]: any }) {
  return request<MallService.ResultObject>(`/mall/product/add`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  })
}

/** 此处后端没有提供注释 POST /product/decreaseStock */
export async function decreaseStock(
  body: MallService.StockDecreaseRequest,
  options?: { [key: string]: any }
) {
  return request<MallService.ResultObject>(`/mall/product/decreaseStock`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  })
}

export async function decreaseStocks(
  body: Array<{
    productId?: number;
    quantity?: number;
  }>,
  options?: { [key: string]: any }
) {
  return request<MallService.ResultObject>(`/mall/product/decreaseStocks`, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  })
}


/** 此处后端没有提供注释 DELETE /product/deleteProduct/${param0} */
export async function deleteProduct(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: MallService.deleteProductParams,
  options?: { [key: string]: any }
) {
  const { id: param0, ...queryParams } = params
  return request<MallService.ResultObject>(`/mall/product/deleteProduct/${param0}`, {
    method: 'DELETE',
    params: { ...queryParams },
    ...(options || {}),
  })
}

/** 此处后端没有提供注释 GET /product/selectById */
export async function selectById(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: MallService.selectByIdParams,
  options?: { [key: string]: any }
) {
  return request<MallService.ResultBizProduct>(`/mall/product/selectById`, {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  })
}

/** 此处后端没有提供注释 GET /product/seller/${param0} */
export async function getProductsBySellerId1(
  // 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
  params: MallService.getProductsBySellerId1Params,
  options?: { [key: string]: any }
) {
  const { sellerUserId: param0, ...queryParams } = params
  return request<MallService.ResultListBizProduct>(`/mall/product/seller/${param0}`, {
    method: 'GET',
    params: { ...queryParams },
    ...(options || {}),
  })
}

/** 此处后端没有提供注释 GET /product/undelete */
export async function getUndeleteProducts(options?: { [key: string]: any }) {
  return request<MallService.ResultListBizProduct>(`/mall/product/undelete`, {
    method: 'GET',
    ...(options || {}),
  })
}

/** 此处后端没有提供注释 PUT /product/update */
export async function updateProduct(
  body: MallService.BizProduct,
  options?: { [key: string]: any }
) {
  return request<MallService.ResultObject>(`/mall/product/update`, {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  })
}
